package com.lian.hope.mapper;

import com.lian.hope.model.vo.ProjectsVO;
import com.lian.hope.model.vo.UserWithIdVO;
import com.lian.hope.model.vo.UsersVO;
import com.lian.hope.model.vo.VolunteerActivitiesVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SearchMapper {


    @Select("select id,nickname,phone_number,avatar_url,points,address,donated,role from users where nickname like concat" +
            "('%'," +
            "#{content}," +
            "'%')")
    List<UsersVO> findUserByName(String content);


    @Select("select id,nickname,phone_number,avatar_url,points,address,role from users where nickname like concat" +
            "('%'," +
            "#{content}," +
            "'%')")
    List<UserWithIdVO> queryUserByName(String query);

    @Select("select * from projects where project_name like concat('%',#{content},'%')")
    List<ProjectsVO> queryProjectsByName(String content);

    @Select("select * from volunteer_activities where activity_name like concat('%',#{content},'%')")
    List<VolunteerActivitiesVO> queryActivityByName(String content);
}
